/// Create： Zhang 3/26/21 4:12 PM
/// 描述：打印log，突破日志打印长度的限制，超出长度拆分打印

class Log {
  ///日志开关
  static bool logSwitch = true;

  //打印日志
  static void d(String tag, dynamic msg) {
    if (!logSwitch) {
      return;
    }
    String p = msg.toString();
    if (p.length > 1000) {
      int num = msg.toString().length ~/ 1000 + 1;
      for (int i = 0; i < num; i++) {
        if (i < num - 1) {
          print(tag + ":" + p.substring(i * 1000, (i + 1) * 1000));
        } else {
          print(tag + ":" + p.substring(i * 1000, p.length));
        }
      }
    } else {
      print("flutter$tag:$p");
    }
  }
}
